#! /usr/bin/python
#! -*- coding: UTF-8 -*-
# yapf: enable
"""
        作者：王楠
        功能：绘制五角星
        版本：3.0
        日期：
        备注：递归函数

"""
import turtle

def draw_branch(branch_length, right_drgee, jianshao, min_branch_length):
    if branch_length > min_branch_length:
        turtle.forward(branch_length)
        print('向前：', branch_length)
        turtle.right(right_drgee)
        print('右转角度：', right_drgee)
        draw_branch(branch_length-jianshao, right_drgee, jianshao, min_branch_length)
        
        
        turtle.left(2*right_drgee)
        print('向左转角度：', 2*right_drgee)
        draw_branch(branch_length-jianshao, right_drgee, jianshao, min_branch_length)

        turtle.right(right_drgee)
        print('右转角度：', right_drgee)
        turtle.backward(branch_length)
        print('向后退：', branch_length)

def main():
    """
        主函数
    """
    turtle.ht()
    turtle.penup()
    turtle.right(90)
    turtle.forward(200)
    turtle.left(90)
    turtle.down()
    turtle.speed(10)
    turtle.color('red')

    turtle.left(90)  #方向向上

    draw_branch(100, 20, 20,5) 
    
    turtle.exitonclick()

    
if __name__ == "__main__":
    main()

